﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace VIP.Manager
{

    public class BasePanel : MonoBehaviour
    {

        //面板的路径
        [HideInInspector]
        public string panelPath;

        //面板对象
        [HideInInspector]
        public GameObject panel;

        //层级
        [HideInInspector]
        public PANEL_LAYER layer;

        //面板的参数
        [HideInInspector]
        public object[] param;

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="args"></param>
        public virtual void Init(params object[] param)
        {
            this.param = param;
        }

        /// <summary>
        /// 显示面板的时候
        /// </summary>
        public virtual void OnShow() { }

        /// <summary>
        /// 关闭面板的时候
        /// </summary>
        public virtual void OnClose() { }

        /// <summary>
        /// 关闭当前面板
        /// </summary>
        protected virtual void Close()
        {
            string name = this.GetType().ToString();
            UIManager.Instance.ClosePanel(name);
        }

    }

}